package org.example.common;

import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {
    @Resource
    private JwtInterceptor jwtInterceptor;
    @Override
    protected void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(jwtInterceptor)   //配置jwt的拦截器规则
                .addPathPatterns("/**")    //拦截所有的请求路径
                .excludePathPatterns("/user/login","/doc.html","/webjars/**");

        super.addInterceptors(registry);
    }
}
